﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category6
{
  public class MT608 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagDefinition U0002;
    private static SwiftTagSubItemDefinition U0003;
    private static SwiftTagDefinition U0004;
    private static SwiftTagSubItemDefinition U0005;
    private static SwiftTagDefinition U0006;
    private static SwiftTagSubItemDefinition U0007;
    private static SwiftTagDefinition U0008;
    private static SwiftTagSubItemDefinition U000E;
    private static SwiftTagSubItemDefinition U000F;
    private static SwiftTagSubItemDefinition U0010;
    private static SwiftTagChoiceDefinition U0011;
    private static SwiftTagDefinition U0012;
    private static SwiftTagDefinition U0013;
    private static SwiftTagDefinition U0014;
    private static SwiftTagSubItemDefinition U0015;
    private static SwiftTagSubItemDefinition U0016;
    private static SwiftTagChoiceDefinition U0017;
    private static SwiftTagDefinition U0018;
    private static SwiftTagDefinition U0019;
    private static SwiftTagDefinition U001A;
    private static SwiftTagDefinition U001B;

    [Description("Transaction Reference Number")]
    public Tag20 TransactionReferenceNumber_20
    {
      get
      {
        return new Tag20((SwiftElement) this, 0, (SwiftDefinitionElement) MT608.U0002);
      }
    }

    [Description("Transaction Reference Number")]
    public Tag20 Tag20_TransactionReferenceNumber
    {
      get
      {
        return this.TransactionReferenceNumber_20;
      }
    }

    [Description("Identification Of The Commodity and The Commodity Account")]
    public Tag26C IdentificationOfTheMetalAndTheMetalAccount_26C
    {
      get
      {
        return new Tag26C((SwiftElement) this, 0, (SwiftDefinitionElement) MT608.U0004);
      }
    }

    [Description("Identification Of The Commodity and The Commodity Account")]
    public Tag26C Tag26C_IdentificationOfTheMetalAndTheMetalAccount
    {
      get
      {
        return this.IdentificationOfTheMetalAndTheMetalAccount_26C;
      }
    }

    [Description("Account Identification")]
    public Tag25 FurtherAccountIdentification_25
    {
      get
      {
        return new Tag25((SwiftElement) this, 0, (SwiftDefinitionElement) MT608.U0006);
      }
    }

    [Description("Account Identification")]
    public Tag25 Tag25_FurtherAccountIdentification
    {
      get
      {
        return this.FurtherAccountIdentification_25;
      }
    }

    [Description("Statement Number/Sequence Number")]
    public Tag28 StatementNumberSequenceNumber_28
    {
      get
      {
        return new Tag28((SwiftElement) this, 0, (SwiftDefinitionElement) MT608.U0008);
      }
    }

    [Description("Statement Number/Sequence Number")]
    public Tag28 Tag28_StatementNumberSequenceNumber
    {
      get
      {
        return this.StatementNumberSequenceNumber_28;
      }
    }

    [Description("Opening Balance")]
    public Tag60F OpeningBalance_60F
    {
      get
      {
        return new Tag60F((SwiftElement) this, 0, (SwiftDefinitionElement) MT608.U0012);
      }
    }

    [Description("Opening Balance")]
    public Tag60F Tag60F_OpeningBalance
    {
      get
      {
        return this.OpeningBalance_60F;
      }
    }

    [Description("Opening Balance")]
    public Tag60M OpeningBalance_60M
    {
      get
      {
        return new Tag60M((SwiftElement) this, 0, (SwiftDefinitionElement) MT608.U0013);
      }
    }

    [Description("Opening Balance")]
    public Tag60M Tag60M_OpeningBalance
    {
      get
      {
        return this.OpeningBalance_60M;
      }
    }

    [Description("Statement Line")]
    public Tag61[] StatementLine_61
    {
      get
      {
        int index = -1;
        List<Tag61> list = new List<Tag61>();
        int count;
        do
        {
          ++index;
          Tag61 tag61 = new Tag61((SwiftElement) this, index, (SwiftDefinitionElement) MT608.U0014);
          count = this.ListTags((SwiftElement) tag61).Count;
          if (count > 0)
            list.Add(tag61);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    [Description("Statement Line")]
    public Tag61[] Tag61_StatementLine
    {
      get
      {
        return this.StatementLine_61;
      }
    }

    [Description("Closing Balance")]
    public Tag62F ClosingBalance_62F
    {
      get
      {
        return new Tag62F((SwiftElement) this, 0, (SwiftDefinitionElement) MT608.U0018);
      }
    }

    [Description("Closing Balance")]
    public Tag62F Tag62F_ClosingBalance
    {
      get
      {
        return this.ClosingBalance_62F;
      }
    }

    [Description("Closing Balance ")]
    public Tag62M ClosingBalance_62M
    {
      get
      {
        return new Tag62M((SwiftElement) this, 0, (SwiftDefinitionElement) MT608.U0019);
      }
    }

    [Description("Closing Balance ")]
    public Tag62M Tag62M_ClosingBalance
    {
      get
      {
        return this.ClosingBalance_62M;
      }
    }

    [Description("Closing Available Balance")]
    public Tag64 ClosingAvailableBalance_64
    {
      get
      {
        return new Tag64((SwiftElement) this, 0, (SwiftDefinitionElement) MT608.U001A);
      }
    }

    [Description("Closing Available Balance")]
    public Tag64 Tag64_ClosingAvailableBalance
    {
      get
      {
        return this.ClosingAvailableBalance_64;
      }
    }

    [Description("Forward Available Balance")]
    public Tag65[] ForwardAvailableBalance_65
    {
      get
      {
        int index = -1;
        List<Tag65> list = new List<Tag65>();
        int count;
        do
        {
          ++index;
          Tag65 tag65 = new Tag65((SwiftElement) this, index, (SwiftDefinitionElement) MT608.U001B);
          count = this.ListTags((SwiftElement) tag65).Count;
          if (count > 0)
            list.Add(tag65);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    [Description("Forward Available Balance")]
    public Tag65[] Tag65_ForwardAvailableBalance
    {
      get
      {
        return this.ForwardAvailableBalance_65;
      }
    }

    public MT608()
      : base(true)
    {
    }

    public MT608(SwiftMessage message)
      : base(message)
    {
    }

    public Tag61 AddStatementLine_61()
    {
      return new Tag61((SwiftElement) this, this.StatementLine_61.Length, (SwiftDefinitionElement) MT608.U0014)
      {
        Value = string.Empty
      };
    }

    public void RemoveStatementLine_61(Tag61 tag)
    {
      this.RemoveTag(tag.GetTag());
    }

    public Tag65 AddForwardAvailableBalance_65()
    {
      return new Tag65((SwiftElement) this, this.ForwardAvailableBalance_65.Length, (SwiftDefinitionElement) MT608.U001B)
      {
        Value = string.Empty
      };
    }

    public void RemoveForwardAvailableBalance_65(Tag65 tag)
    {
      this.RemoveTag(tag.GetTag());
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT608.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT608.MessageDefinition = new SwiftMessageDefinition("MT608", "Statement of a Commodity Account");
      MT608.U0002 = new SwiftTagDefinition("TransactionReferenceNumber_20", "Transaction Reference Number");
      MT608.U0002.TagName = ":20:";
      MT608.U0003 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT608.U0002.Elements.Add((SwiftDefinitionElement) MT608.U0003);
      MT608.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT608.U0002);
      MT608.U0004 = new SwiftTagDefinition("IdentificationOfTheMetalAndTheMetalAccount_26C", "Identification Of The Commodity and The Commodity Account");
      MT608.U0004.TagName = ":26C:";
      MT608.U0005 = new SwiftTagSubItemDefinition("IdentificationOfTheMetal", "Identification Of The Commodity");
      MT608.U0004.Elements.Add((SwiftDefinitionElement) MT608.U0005);
      MT608.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT608.U0004);
      MT608.U0006 = new SwiftTagDefinition("FurtherAccountIdentification_25", "Account Identification");
      MT608.U0006.TagName = ":25:";
      MT608.U0006.Mandatory = false;
      MT608.U0007 = new SwiftTagSubItemDefinition("FurtherAccountIdentification", "Further Account Identification");
      MT608.U0006.Elements.Add((SwiftDefinitionElement) MT608.U0007);
      MT608.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT608.U0006);
      MT608.U0008 = new SwiftTagDefinition("StatementNumberSequenceNumber_28", "Statement Number/Sequence Number");
      MT608.U0008.TagName = ":28:";
      MT608.U000E = new SwiftTagSubItemDefinition("StatementNumber", "Statement Number");
      MT608.U0008.Elements.Add((SwiftDefinitionElement) MT608.U000E);
      MT608.U000F = new SwiftTagSubItemDefinition("SequenceNumber", "Sequence Number");
      MT608.U000F.Mandatory = false;
      MT608.U0010 = new SwiftTagSubItemDefinition("SequenceNumber_1", "Sequence Number");
      MT608.U000F.Elements.Add((SwiftDefinitionElement) MT608.U0010);
      MT608.U0008.Elements.Add((SwiftDefinitionElement) MT608.U000F);
      MT608.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT608.U0008);
      MT608.U0011 = new SwiftTagChoiceDefinition("Choice", "");
      MT608.U0011.Multiple = true;
      MT608.U0012 = new SwiftTagDefinition("OpeningBalance_60F", "Opening Balance");
      MT608.U0012.TagName = ":60F:";
      MT608.U0011.Elements.Add((SwiftDefinitionElement) MT608.U0012);
      MT608.U0013 = new SwiftTagDefinition("OpeningBalance_60M", "Opening Balance");
      MT608.U0013.TagName = ":60M:";
      MT608.U0011.Elements.Add((SwiftDefinitionElement) MT608.U0013);
      MT608.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT608.U0011);
      MT608.U0014 = new SwiftTagDefinition("StatementLine_61", "Statement Line");
      MT608.U0014.TagName = ":61:";
      MT608.U0014.Mandatory = false;
      MT608.U0014.Multiple = true;
      MT608.U0015 = new SwiftTagSubItemDefinition("StatementLine", "Statement Line");
      MT608.U0014.Elements.Add((SwiftDefinitionElement) MT608.U0015);
      MT608.U0016 = new SwiftTagSubItemDefinition("Supplementarydetails", "Supplementary Details");
      MT608.U0016.Mandatory = false;
      MT608.U0014.Elements.Add((SwiftDefinitionElement) MT608.U0016);
      MT608.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT608.U0014);
      MT608.U0017 = new SwiftTagChoiceDefinition("Choice", "");
      MT608.U0017.Multiple = true;
      MT608.U0018 = new SwiftTagDefinition("ClosingBalance_62F", "Closing Balance");
      MT608.U0018.TagName = ":62F:";
      MT608.U0018.Mandatory = false;
      MT608.U0017.Elements.Add((SwiftDefinitionElement) MT608.U0018);
      MT608.U0019 = new SwiftTagDefinition("ClosingBalance_62M", "Closing Balance ");
      MT608.U0019.TagName = ":62M:";
      MT608.U0019.Mandatory = false;
      MT608.U0017.Elements.Add((SwiftDefinitionElement) MT608.U0019);
      MT608.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT608.U0017);
      MT608.U001A = new SwiftTagDefinition("ClosingAvailableBalance_64", "Closing Available Balance");
      MT608.U001A.TagName = ":64:";
      MT608.U001A.Mandatory = false;
      MT608.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT608.U001A);
      MT608.U001B = new SwiftTagDefinition("ForwardAvailableBalance_65", "Forward Available Balance");
      MT608.U001B.TagName = ":65:";
      MT608.U001B.Mandatory = false;
      MT608.U001B.Multiple = true;
      MT608.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT608.U001B);
    }
  }
}
